package dao

import (
	"gorm.io/gorm"
	"kf/models/entity"
	"time"
)

type UserClientDao struct {
	DB *gorm.DB
}

func (userClientDao *UserClientDao) CreateUserClient(kefu, clientId string) uint {
	u := &entity.UserClient{
		Kefu:       kefu,
		Client_id:  clientId,
		Created_at: time.Now().Format("2006-01-02 15:04:05"),
	}
	userClientDao.DB.Create(u)
	return u.ID
}
func (userClientDao *UserClientDao) FindClients(kefu string) []entity.UserClient {
	var arr []entity.UserClient
	userClientDao.DB.Where("kefu = ?", kefu).Find(&arr)
	return arr
}
